<%@ taglib prefix="security"
  uri="http://www.springframework.org/security/tags"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<security:authentication property="name" var="username" />

<!DOCTYPE html>
<html>
  <head>
  <title>Page Title</title>
  
  <link rel="stylesheet" type="text/css" href="/css/css.css" />
  </head>
  <body>
    <div class="header">
      <div class="left">
        <div id="title">Users</div>
      </div>
  
      <div class="right">
        <div id="userArea" class="right">
          Logged in as: ${username} <br /> <a href="logout.html">Log
            out</a>
        </div>
      </div>
    </div>
  
    <div class="content-container">
      <jsp:include page="/jsp/include/menu.jsp"><jsp:param
          value="users" name="selected" /></jsp:include>
  
      <div class="content">
        <h3>Users</h3>
        
        <div class="row toolbar">
          <img id="createNewUser" src="/images/seamless_bg.png" title="Create a new User" />
          <span class="separator"></span>
          <div class="clear"></div>
        </div>
  
        <c:if test="${not empty userList}">
          <div class="row">
            <table>
              <thead>
                <tr>
                  <th>Username</th>
                  <th>Email</th>
                  <th>Signup Date</th>
                  <th>Roles</th>
                  <th width="5%"></th>
                </tr>
              </thead>
              <tbody>
                <c:forEach items="${userList}" var="user">
                  <tr>
                    <td>${user.username}</td>
                    <td>${user.email}</td>
                    <td><fmt:formatDate
                        value="${user.signupDate.time}"
                        pattern="yyyy-MM-dd" />
                    </td>
                    <td>${user.roles}</td>
                    <td><a href="#">Delete</a>
                  </tr>
                </c:forEach>
              </tbody>
            </table>
          </div>
        </c:if>
      </div>
    </div>
  
    <jsp:include page="/jsp/include/footer.jsp" />
  </body>
</html>